<template>

    <xy-general-panel>

        <xy-collapse-search-bar>
            <el-form ref="searchForm" :inline="true" :rules="searchFormRules" :model="searchForm" label-width="80px"
                     @submit.native.prevent>

                <el-form-item prop="level">
                    <el-select v-model.trim="searchForm.level" clearable placeholder="日志级别">
                        <el-option
                                v-for="item in loggerOptions"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item prop="logName">
                    <el-input v-model.trim="searchForm.logName" placeholder="日志名称"
                              @keyup.enter.native="refreshTable"
                              class="handle-input mr10"></el-input>
                </el-form-item>

                <el-form-item>
                    <el-button type="primary" @click="refreshTable" icon="search">搜索</el-button>
                    <el-button @click="resetSearchForm">重置</el-button>
                </el-form-item>
            </el-form>
        </xy-collapse-search-bar>

        <xy-logback-log-table ref="logbackTable" :searchParam="searchForm" ></xy-logback-log-table>

    </xy-general-panel>
</template>

<script>
    import xyLogbackLogTable from './LogbackLogTable';

    /**
     * 系统日志主页
     * @author Canaan
     * @date 2019/6/18 14:28.
     */
    export default {
        name: 'logbackLogIndex',
        mounted() {

        },
        components: {
            xyLogbackLogTable
        },
        props: {},
        data() {
            return {
                searchFormRules: {},
                searchForm: {
                    logName:null,
                    level:"ERROR",
                },
                loggerOptions: [{
                    value: 'ERROR',
                    label: '错误'
                }, {
                    value: 'WARN',
                    label: '警告'
                }],

            }
        },
        computed: {},
        methods: {

            refreshTable() {
                this.$refs.logbackTable.loadData();
            },
            resetSearchForm() {
                this.$refs.searchForm.resetFields();
                this.refreshTable();
            }
        },
        watch: {},
        filters: {},
        beforeDestroy() {

        }
    }
</script>

<style scoped>

</style>